package com.example.controller;


import com.example.common.util.MinioUtil;
import com.example.common.util.oConvertUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/upload")
public class UploadController {
    //上传文件
    @PostMapping("/test")
    public String uploadFile(@RequestParam("file")  MultipartFile file){
        String file_url = MinioUtil.syncUpload(file, "test");
        if (oConvertUtils.isEmpty(file_url)) {
            return "上传失败";
        }
        //返回文件信息
        return file_url;
    }



}
